#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>

int main(int argc, char const *argv[])
{
    int fd;

    if (argc != 2) {
        //C:\Users\ZhiLun\Desktop\朱威煌\嵌入式\iot_path\pashe4\01io_open\demo1.exe
        fprintf(stderr, "Usage: <%s> <pathname> \n", argv[0]);
        return -1;
    }
    // 只读打开该文件
    fd = open(argv[1], O_RDONLY);

    if (fd == -1) {
        perror(" Open():");
        return -1;
    }
    close(fd);
    return 0;
}
